package com.company;

import java.util.HashMap;

public class Task1 {


    public static void main(String[] args) {
        //todo 1. 统计每个单词出现的次数
        // 有如下字符串"If you want to change your life I think you must come to learn English"(用空格间隔)
        // 打印格式：
        // to=3
        // think=1
        // you=2
        String str = "If you want to change your life I think you must come to learn English";
        String[] arr = str.split(" ");
        HashMap<String,Integer> map =new HashMap<String,Integer>();
        for (String ss : arr){
            if(map.get(ss) == null){
                map.put(ss,1);
            }else{
                map.put(ss,map.get(ss)+1);
            }
        }
        System.out.println(map);

    }

}
